<?php

class LogoutController {
	
	private $m_loginHandler = "";
	private $m_loginView = "";
	
	public function __construct ($a_loginHandler, $a_loginView){
		$this->m_loginHandler = $a_loginHandler;
		$this->m_loginView = $a_loginView;
	} 
	
	public function DoControl (){
		//If user tried to log out do call function removecookies and function dologout print "Du loggades ut"
		if ($this->m_loginView -> TriedToLogout()) {
			$this->m_loginView -> RemoveCookiesNSetLogoutState();
			if($this -> m_loginHandler -> DoLogout()){
				return $this->m_loginView->LogoutSuccess();
			}else{
				//it's a work in progress... 
			}
		}
	}
}